<?php
session_start();
$directory = "data/";
$filename = "data/userevent.dat";

if (file_exists($filename))
{
  $contents = file_get_contents($filename);
  $today = date("Y-m-d");
  $fp = fopen($directory.$today.".event", 'w');
  fwrite($fp, $contents);
  fclose($fp);
}
header('Location: index.php');
?>